var jumpTime = 1;//跳转时间2秒

/**
 * 回调提示
 * @param {type} status 布尔值
 * @param {type} tips 提示信息
 * @returns {undefined} label标签
 */
function callBackTips(status, tips, url) {
    icon = status > 0 ? 'succeed' : 'error';
    art.dialog({
        "icon": icon,
        "title": '消息',
        "id": "loadding",
        "lock": true,
        "fixed": true,
        "drag": false
    }).content(tips).time(1.5);

    if (!Utils.isEmpty(url)) {
        var interval = setInterval(function() {
            clearInterval(interval);
            // console.log(url);
            location.href = url;
        }, jumpTime * 1500);
    }

}

/**
 * 表单提示信息显示
 * @param {object} obj 表单对象
 * @param {string} info 提示信息
 * @param {status} bool 默认为false，错误提示
 */
function showMessageTips(obj, info, status) {
    var info = (typeof (arguments[1]) == "undefined") ? '' : arguments[1];
    var status = (typeof (arguments[2]) == "undefined") ? false : arguments[2];
    var labObj = obj.next('label');
    var labDefaultTips = labObj.attr('defaultTips');
    if (labDefaultTips == null) {
        labObj.attr('defaultTips', labObj.html());
    }

    labObj.removeClass('ajax_true').removeClass('ajax_false');

    status == true ? labObj.addClass('ajax_true') : labObj.addClass('ajax_false');

    if (info != null)
        labObj.html(info);

}

//重写art.dialog.alert()
art.dialog.alert = function(msg) {
    art.dialog({
        id: 'alert',
        title: langjs.message,
        icon: 'warning',
        opacity: .1,
        resize: false,
        lock: true,
        fixed: true,
        content: msg,
        button: [
            {
                name: '确定',
                focus: true
            }
        ]
    });
};

art.dialog.confirm = function(content, yes, no) {
    art.dialog({
        id: 'confirm',
        title: '消息',
        icon: 'question',
        opacity: .1,
        resize: false,
        lock: true,
        fixed: true,
        content: content,
        button: [
            {
                name: '确定',
                callback: function() {
                    return yes && yes.call(this);
                },
                focus: true
            },
            {
                name: '取消',
                callback: function() {
                    return no && no.call(this);
                }
            }
        ]
    });

};

window.loadding = function(message) {
    var msg = message ? message : '系统正在处理，请稍候...';
    art.dialog({
        "title": false,
        "id": "loadding",
        "lock": false,
        "fixed": true,
        "drag": false,
        "resize": false,
        "zIndex": 10000,
        "cancel": false

    }).content('<div style="padding: 0 1em;">' + msg + '</div>');

};

window.unloadding = function() {
    art.dialog({"id": "loadding"}).close();
};

/**
 * 显示默认提示
 * @param {type} obj
 * @returns {undefined}
 */
function showDefaultTips(obj) {
    var labObj = obj.next('label');

    var labDefaultTips = labObj.attr('defaultTips');

    if (labDefaultTips != null) {
        labObj.html(labDefaultTips).removeClass('ajax_false').removeClass('ajax_true');
    }
}



//function cloneTableTitle(obj) {
//    $('<table><tbody></tbody></table>', {
//        class: 'table_list',
//        cellspacing: '0'
//    });
//    var newTitle = $(obj + '>tbody').children('tr:first').clone();
//
//}

